package com.heyqing.bruteForce;

import java.util.Scanner;

/**
 * ClassName:Backpack
 * Package:com.heyqing.bruteForce
 * Description:
 *
 * @Date:2024/6/10
 * @Author:Heyqing
 */
public class Backpack {
    //物品数量
    private int goodsNumber;
    //物品重量
    private int[] weights;
    //物品价值
    private int[] values;
    //背包容量
    private int capacity;

    public Backpack() {
        //初始化
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入背包的容量：");
        this.capacity = sc.nextInt();
        System.out.print("请输入物品数量：");
        this.goodsNumber = sc.nextInt();
        this.weights = new int[this.goodsNumber];
        this.values = new int[this.goodsNumber];
        for (int i = 0; i < goodsNumber; i++) {
            System.out.print("请输入第" + (i + 1) +"个物品的=>重量：");
            int w = sc.nextInt();
            System.out.print("请输入第" + (i + 1) +"个物品的=>价值：");
            int v = sc.nextInt();
            this.weights[i] = w;
            this.values[i] = v;
        }
        sc.close();
    }

    public int getGoodsNumber() {
        return goodsNumber;
    }

    public int[] getWeights() {
        return weights;
    }

    public int[] getValues() {
        return values;
    }

    public int getCapacity() {
        return capacity;
    }
}
